package kr.co.dongpang.android;

import java.text.DecimalFormat;

import kr.co.dongpang.android.R;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class DmMarketing3Fragment extends Fragment {



	DecimalFormat df = new DecimalFormat("###,###");

	public DmMarketing3Fragment() {
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

		View rootView = inflater.inflate(R.layout.marketing3, container, false);
		
		new printTask().execute(null,null,null);

		return rootView;
	}

	class printTask extends AsyncTask<Void, Void, Void>{

		@Override
		protected Void doInBackground(Void... params) {
			// TODO Auto-generated method stub
			return null;
		}
		
		protected void onPostExecute(Void result){
			
			((TextView) getActivity().findViewById(R.id.desc)).setText(getArguments().getString("desc"));
			((TextView) getActivity().findViewById(R.id.periodText)).setText(getArguments().getString("periodText"));
			
			((Button) getActivity().findViewById(R.id.goNext)).setOnClickListener(new Button.OnClickListener() {
				public void onClick(View v) {
					Fragment fragment = new DmAdvertise1Fragment();
					FragmentManager fragmentManager = getFragmentManager();
					fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();	
				}
			});				
			
			super.onPostExecute(result);
		}
		
	}
	
}
